﻿using System;

namespace QDT.Core.Experience
{
    public class ExpProject : Entity
    {

        public ExpProject()
        {
            CreateTime = DateTime.Now;
            Status = 0;
        }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }
        
        /// <summary>
        /// 利率
        /// </summary>
        public double Rate { get; set; }

        /// <summary>
        /// 期限
        /// </summary>
        public int Days { get; set; }

        /// <summary>
        /// 借款金额
        /// </summary>
        public decimal BorrowAmount { get; set; }

        /// <summary>
        /// 最大投资金额
        /// </summary>
        public decimal MaxLoanMoney { get; set; }

        /// <summary>
        /// 最小投资金额
        /// </summary>
        public decimal MinLoanMoney { get; set; }

        /// <summary>
        /// 项目状态(0：等待材料，1：进行中，2：还款中，3：已还清)
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 已经融到的总金额
        /// </summary>
        public decimal LoadMoney { get; set; }

        /// <summary>
        /// 已经还款总金额
        /// </summary>
        public decimal RepayMoney { get; set; }

        /// <summary>
        /// 是否已经还款
        /// </summary>
        public bool IsRepay { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; private set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 还款开始时间
        /// </summary>
        public DateTime? RepayStartTime { get; set; }

        /// <summary>
        /// 还款结束时间
        /// </summary>
        public DateTime? RepayEndTime { get; set; }

        /// <summary>
        /// 时间戳（数据库锁）
        /// </summary>
        public byte[] TimeStamp { get; set; }

        /// <summary>
        /// 可投余额
        /// </summary>
        public decimal NeedMoney
        {
            get { return BorrowAmount - LoadMoney; }
        }
    }
}
